﻿using System;
using System.Collections.Generic;
using UnityEngine;
using Util;

namespace Core.Animation {
    public class AnimationSystem : MonoSingleton<AnimationSystem> {
        private Dictionary<GameObject, AnimationState> mStateDic = new();

        public void Add(GameObject obj,AnimationState state) {
            if (mStateDic.ContainsKey(obj)) {
                mStateDic[obj] = state;
            }
            mStateDic.TryAdd(obj, state);
        }

        private void Update() {
            foreach (var state in mStateDic.Values) {
                state.Updater(Time.deltaTime);
            }
        }
    }
}